// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////

#pragma once

class CMainFrame : public CFrameWindowImpl<CMainFrame>, public CUpdateUI<CMainFrame>,
		public CMessageFilter, public CIdleHandler
{
public:
	DECLARE_FRAME_WND_CLASS(NULL, IDR_MAINFRAME)
	
	CQuicksView m_view;
	bool m_init;
	HINSTANCE m_hInstance;

	CMainFrame(HINSTANCE hInstance);
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	virtual BOOL OnIdle();

	BEGIN_UPDATE_UI_MAP(CMainFrame)
	END_UPDATE_UI_MAP()

	BEGIN_MSG_MAP(CMainFrame)
		MESSAGE_HANDLER(WM_CREATE, OnCreate)
		MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
		MSG_WM_CTLCOLORSTATIC(OnCtlColorStatic)

		COMMAND_ID_HANDLER(ID_NEXT_MATCH, OnNextMatch)
		COMMAND_ID_HANDLER(ID_PREV_MATCH, OnPrevMatch)
		COMMAND_ID_HANDLER(ID_NEXT_CHAR, m_view.OnNextChar)
		COMMAND_ID_HANDLER(ID_PREV_CHAR, m_view.OnPrevChar)
		COMMAND_ID_HANDLER(ID_NEXT_WORD, m_view.OnNextWord)
		COMMAND_ID_HANDLER(ID_PREV_WORD, m_view.OnPrevWord)
		COMMAND_ID_HANDLER(ID_FIRST, m_view.OnFirst)
		COMMAND_ID_HANDLER(ID_LAST, m_view.OnLast)
		COMMAND_ID_HANDLER(ID_KILL_LINE, m_view.OnKillLine)
		COMMAND_ID_HANDLER(ID_KILL_WORD, m_view.OnKillWord)
		COMMAND_ID_HANDLER(ID_KILL_WORD_FORWARD, m_view.OnKillWordForward)
		COMMAND_ID_HANDLER(ID_KILL_WORD_FORWARD2, m_view.OnKillWordForward)
		COMMAND_ID_HANDLER(ID_KILL_CHAR_FORWARD, m_view.OnKillCharForward)
		CHAIN_MSG_MAP(CUpdateUI<CMainFrame>)
		CHAIN_MSG_MAP(CFrameWindowImpl<CMainFrame>)
	END_MSG_MAP()

// Handler prototypes (uncomment arguments if needed):
//	LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
//	LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
//	LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)

	LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
	LRESULT OnNextMatch(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnPrevMatch(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	HBRUSH OnCtlColorStatic(CDCHandle dc, CStatic wndStatic);
private:
	HHOOK m_hhkLowLevelKybd;
};
